# -*- coding:utf-8 -*-
"""
Created on 01.05.2010

@author: Пользователь
"""

from copy import deepcopy
from django.forms import *
from django.contrib.admin.widgets import AdminDateWidget


class BasePersonForm(ModelForm):
    FIELD_CLASSES = 
    {
        'integer' : IntegerField(),
        'float' : FloatField(),
        'string' : CharField(),
        'boolean' : BooleanField(),
        'datetime' : DateTimeField()
    }
    FIELD_EXTRA = 
    {
        'datetime' : AdminDateWidget(),
    }
    
    def __init__(self, data=None, *args, **kwargs):
        super(BasePersonForm, self).__init__(data, *args, **kwargs)
        self._build_dynamic_fields()
    
    def _build_dynamic_fields(self):
        self.fields = deepcopy(self.base_fields)
        
        